package com.winit.openapi.oauth.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.winit.common.orm.mybatis.MyBatisPageRepo;
import com.winit.common.orm.mybatis.MyBatisRepo;
import com.winit.common.orm.mybatis.PageBase;
import com.winit.common.query.Searchable;
import com.winit.openapi.oauth.entity.APIClientEntity;

@MyBatisRepo
public interface APIClientDao extends MyBatisPageRepo<APIClientEntity, Long> {

    int insertClient(APIClientEntity entity);

    APIClientEntity selectByNameAndDeveloperId(@Param("developerId") Long developerId,
                                               @Param("clientName") String clientName);

    APIClientEntity selectById(Long clientId);

    APIClientEntity selectByClientKey(String clientKey);

    APIClientEntity checkLogin(@Param("clientKey") String clientKey, @Param("clientSecret") String clientSecret);

    void updateClient(APIClientEntity entity);

    void deleteClient(Long id);

    Long checkClientCode(@Param("clientCode") String clientCode);

    List<APIClientEntity> getByDeveloperId(@Param("developerId") Long developerId);

    PageBase<APIClientEntity> find(Searchable searchable);
    
    List<APIClientEntity> findAll();

}
